package com.tepth.appmanageservice.protocol.bodys.ordinaryfile;

import com.tepth.appmanageservice.protocol.interfaces.ISend;
import com.tepth.appmanageservice.tools.ext.ExtToBytes;

public class OrdinaryFileRequest implements ISend {
	public static final short ID = 0x0E23;

	private byte fileType;// �ļ�����
	private String md5; // MD5ֵ
	private short packetNo; // �����
	private byte[] data;

	public byte getFileType() {
		return this.fileType;
	}

	public void setFileType(byte fileType) {
		this.fileType = fileType;
	}

	public String getMd5() {
		return this.md5;
	}

	public void setMd5(String md5) {
		this.md5 = md5;
	}

	public short getPacketNo() {
		return this.packetNo;
	}

	public void setPacketNo(short packetNo) {
		this.packetNo = packetNo;
	}

	@Override
	public short getId() {
		return ID;
	}

	@Override
	public short getLength() {
		return (short) this.data.length;
	}

	@Override
	public byte[] getResult() {
		return this.data;
	}

	@Override
	public void load() {
		byte[][] datas = new byte[3][];
		datas[0] = ExtToBytes.fromNumber(this.fileType);
		datas[1] = ExtToBytes.fromString16(this.md5);
		datas[2] = ExtToBytes.fromNumber(this.packetNo);

		this.data = ExtToBytes.fromByteArray2(datas);
	}
}